<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>RF22: RF22ReliableDatagram Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">RF22
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">RF22ReliableDatagram Class Reference</div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="RF22ReliableDatagram" --><!-- doxytag: inherits="RF22Datagram" -->
<p><a class="el" href="classRF22.html" title="Send and receive unaddressed, unreliable datagrams.">RF22</a> subclass for sending addressed, acknowledged, retransmitted datagrams.  
 <a href="classRF22ReliableDatagram.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="RF22ReliableDatagram_8h_source.html">RF22ReliableDatagram.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for RF22ReliableDatagram:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classRF22ReliableDatagram.png" usemap="#RF22ReliableDatagram_map" alt=""/>
  <map id="RF22ReliableDatagram_map" name="RF22ReliableDatagram_map">
<area href="classRF22Datagram.html" title="RF22 subclass for addressed, unreliable messages." alt="RF22Datagram" shape="rect" coords="0,56,141,80"/>
<area href="classRF22.html" title="Send and receive unaddressed, unreliable datagrams." alt="RF22" shape="rect" coords="0,0,141,24"/>
<area href="classRF22Router.html" title="RF22 subclass for sending addressed, optionally acknowledged datagrams multi-hop routed across a netw..." alt="RF22Router" shape="rect" coords="0,168,141,192"/>
<area href="classRF22Mesh.html" title="RF22 subclass for sending addressed, optionally acknowledged datagrams multi-hop routed across a netw..." alt="RF22Mesh" shape="rect" coords="0,224,141,248"/>
</map>
 </div></div>

<p><a href="classRF22ReliableDatagram-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRF22ReliableDatagram.html#ac5c5c271003d79f6ae268693087eb224">RF22ReliableDatagram</a> (uint8_t thisAddress=0, uint8_t slaveSelectPin=10, uint8_t interrupt=0)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRF22ReliableDatagram.html#a57e6fe9fec497df332ce1f533bf2b2ec">setTimeout</a> (uint16_t timeout)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRF22ReliableDatagram.html#add0bf2e27e9ea07871dbe9689dcef465">setRetries</a> (uint8_t retries)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">boolean&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRF22ReliableDatagram.html#a47e85bffb81a3acdff6d5f15ce7bb65e">sendtoWait</a> (uint8_t *buf, uint8_t len, uint8_t address)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">boolean&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRF22ReliableDatagram.html#a49dbf986b90cac7f1476ec56a4beab38">recvfromAck</a> (uint8_t *buf, uint8_t *len, uint8_t *from=NULL, uint8_t *to=NULL, uint8_t *id=NULL, uint8_t *flags=NULL)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">boolean&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRF22ReliableDatagram.html#a0327f5c2c296c483df90b1f52ec2d141">recvfromAckTimeout</a> (uint8_t *buf, uint8_t *len, uint16_t timeout, uint8_t *from=NULL, uint8_t *to=NULL, uint8_t *id=NULL, uint8_t *flags=NULL)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRF22ReliableDatagram.html#a797ad6d1face3b9c4e8862e202a26e5b">retransmissions</a> ()</td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRF22ReliableDatagram.html#aec55325c6ab74809a3ef9c90aef39adc">acknowledge</a> (uint8_t id, uint8_t from)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">boolean&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRF22ReliableDatagram.html#a90288b60894ace02cea63f2cfa7a9c17">haveNewMessage</a> ()</td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classRF22.html" title="Send and receive unaddressed, unreliable datagrams.">RF22</a> subclass for sending addressed, acknowledged, retransmitted datagrams. </p>
<p>Extends <a class="el" href="classRF22Datagram.html" title="RF22 subclass for addressed, unreliable messages.">RF22Datagram</a> to define addressed, reliable datagrams with acknowledgement and retransmission. Based on <a class="el" href="classRF22Datagram.html" title="RF22 subclass for addressed, unreliable messages.">RF22Datagram</a>, adds flags and sequence numbers. <a class="el" href="classRF22ReliableDatagram.html" title="RF22 subclass for sending addressed, acknowledged, retransmitted datagrams.">RF22ReliableDatagram</a> is reliable in the sense that messages are acknowledged, and unacknowledged messages are retransmitted until acknowledged or the retries are exhausted. When addressed messages are sent (by <a class="el" href="classRF22ReliableDatagram.html#a47e85bffb81a3acdff6d5f15ce7bb65e">sendtoWait()</a>), it will wait for an ack, and retransmit after timeout until an ack is received or retries are exhausted. When addressed messages are collected by the application (by <a class="el" href="classRF22ReliableDatagram.html#a49dbf986b90cac7f1476ec56a4beab38">recvfromAck()</a>), an acknowledgement is automatically sent.</p>
<p>The retransmit timeout is randomly varied between timeout and timeout*2 to prevent collisions on all retries when 2 nodes happen to start sending at the same time .</p>
<p>Each new message sent by <a class="el" href="classRF22ReliableDatagram.html#a47e85bffb81a3acdff6d5f15ce7bb65e">sendtoWait()</a> has its ID incremented.</p>
<p>An ack consists of a message with:</p>
<ul>
<li>TO set to the from address of the original message</li>
<li>FROM set to this node address</li>
<li>ID set to the ID of the original message</li>
<li>FLAGS with the RF22_FLAGS_ACK bit set</li>
</ul>
<p>Part of the Arduino <a class="el" href="classRF22.html" title="Send and receive unaddressed, unreliable datagrams.">RF22</a> library for operating with HopeRF <a class="el" href="classRF22.html" title="Send and receive unaddressed, unreliable datagrams.">RF22</a> compatible transceivers (see <a href="http://www.hoperf.com">http://www.hoperf.com</a>) </p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ac5c5c271003d79f6ae268693087eb224"></a><!-- doxytag: member="RF22ReliableDatagram::RF22ReliableDatagram" ref="ac5c5c271003d79f6ae268693087eb224" args="(uint8_t thisAddress=0, uint8_t slaveSelectPin=10, uint8_t interrupt=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">RF22ReliableDatagram::RF22ReliableDatagram </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>thisAddress</em> = <code>0</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>slaveSelectPin</em> = <code>10</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>interrupt</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Constructor. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">thisAddress</td><td>The address to assign to this node. Defaults to 0 </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">slaveSelectPin</td><td>the Arduino pin number of the output to use to select the <a class="el" href="classRF22.html" title="Send and receive unaddressed, unreliable datagrams.">RF22</a> before accessing it </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">interrupt</td><td>The interrupt number to use. Default is interrupt 0 (Arduino input pin 2) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="aec55325c6ab74809a3ef9c90aef39adc"></a><!-- doxytag: member="RF22ReliableDatagram::acknowledge" ref="aec55325c6ab74809a3ef9c90aef39adc" args="(uint8_t id, uint8_t from)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void RF22ReliableDatagram::acknowledge </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>from</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Send an ACK for the message id to the given from address Blocks until the ACK has been sent </p>

<p>References <a class="el" href="classRF22Datagram.html#a316535aeb1cb389b593df5f8f1f38983">RF22Datagram::sendto()</a>, <a class="el" href="classRF22.html#adb3ce5021865459e770e45cc434a0dd0">RF22::setHeaderFlags()</a>, <a class="el" href="classRF22.html#a7a36edc1913d6cec8892af8ea8a28ef7">RF22::setHeaderId()</a>, and <a class="el" href="classRF22.html#a8ce6d4f63ce1ea37ab108c01f9476555">RF22::waitPacketSent()</a>.</p>

<p>Referenced by <a class="el" href="classRF22ReliableDatagram.html#a49dbf986b90cac7f1476ec56a4beab38">recvfromAck()</a>, and <a class="el" href="classRF22ReliableDatagram.html#a47e85bffb81a3acdff6d5f15ce7bb65e">sendtoWait()</a>.</p>

</div>
</div>
<a class="anchor" id="a90288b60894ace02cea63f2cfa7a9c17"></a><!-- doxytag: member="RF22ReliableDatagram::haveNewMessage" ref="a90288b60894ace02cea63f2cfa7a9c17" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">boolean RF22ReliableDatagram::haveNewMessage </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Checks whether the message currently in the Rx buffer is a new message, not previously received based on the from address and the sequence. If it is new, it is acknowledged and returns true </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if there is a message received and it is a new message </dd></dl>

</div>
</div>
<a class="anchor" id="a49dbf986b90cac7f1476ec56a4beab38"></a><!-- doxytag: member="RF22ReliableDatagram::recvfromAck" ref="a49dbf986b90cac7f1476ec56a4beab38" args="(uint8_t *buf, uint8_t *len, uint8_t *from=NULL, uint8_t *to=NULL, uint8_t *id=NULL, uint8_t *flags=NULL)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">boolean RF22ReliableDatagram::recvfromAck </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>from</em> = <code>NULL</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>to</em> = <code>NULL</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>id</em> = <code>NULL</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>flags</em> = <code>NULL</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>If there is a valid message available for this node, send an acknowledgement to the SRC address (blocking until this is complete), then copy the message to buf and return true else return false. If a message is copied, *len is set to the length.. If from is not NULL, the SRC address is placed in *from. If to is not NULL, the DEST address is placed in *to. This is the preferred function for getting messages addressed to this node. If the message is not a broadcast, acknowledge to the sender before returning. You should be sure to call this function frequently enough to not miss any messages It is recommended that you call it in your main loop. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">buf</td><td>Location to copy the received message </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">len</td><td>Available space in buf. Set to the actual number of octets copied. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">from</td><td>If present and not NULL, the referenced uint8_t will be set to the SRC address </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">to</td><td>If present and not NULL, the referenced uint8_t will be set to the DEST address </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>If present and not NULL, the referenced uint8_t will be set to the ID </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">flags</td><td>If present and not NULL, the referenced uint8_t will be set to the FLAGS (not just those addressed to this node). </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if a valid message was copied to buf </dd></dl>

<p>Reimplemented in <a class="el" href="classRF22Router.html#abbb4344322693607d8a0be5f0f831015">RF22Router</a>, and <a class="el" href="classRF22Mesh.html#a5702996188d7b3941a844fc4d39a6f57">RF22Mesh</a>.</p>

<p>References <a class="el" href="classRF22ReliableDatagram.html#aec55325c6ab74809a3ef9c90aef39adc">acknowledge()</a>, <a class="el" href="classRF22.html#af899b8b15c5c4b345e7f9860d45d0292">RF22::available()</a>, and <a class="el" href="classRF22Datagram.html#ab545144cb8529f5b5ef0dcb77a252eef">RF22Datagram::recvfrom()</a>.</p>

<p>Referenced by <a class="el" href="classRF22Router.html#abbb4344322693607d8a0be5f0f831015">RF22Router::recvfromAck()</a>, and <a class="el" href="classRF22ReliableDatagram.html#a0327f5c2c296c483df90b1f52ec2d141">recvfromAckTimeout()</a>.</p>

</div>
</div>
<a class="anchor" id="a0327f5c2c296c483df90b1f52ec2d141"></a><!-- doxytag: member="RF22ReliableDatagram::recvfromAckTimeout" ref="a0327f5c2c296c483df90b1f52ec2d141" args="(uint8_t *buf, uint8_t *len, uint16_t timeout, uint8_t *from=NULL, uint8_t *to=NULL, uint8_t *id=NULL, uint8_t *flags=NULL)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">boolean RF22ReliableDatagram::recvfromAckTimeout </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>timeout</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>from</em> = <code>NULL</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>to</em> = <code>NULL</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>id</em> = <code>NULL</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>flags</em> = <code>NULL</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Similar to <a class="el" href="classRF22ReliableDatagram.html#a49dbf986b90cac7f1476ec56a4beab38">recvfromAck()</a>, this will block until either a valid message available for this node or the timeout expires. Starts the receiver automatically. You should be sure to call this function frequently enough to not miss any messages It is recommended that you call it in your main loop. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">buf</td><td>Location to copy the received message </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">len</td><td>Available space in buf. Set to the actual number of octets copied. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">timeout</td><td>Maximum time to wait in milliseconds </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">from</td><td>If present and not NULL, the referenced uint8_t will be set to the SRC address </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">to</td><td>If present and not NULL, the referenced uint8_t will be set to the DEST address </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>If present and not NULL, the referenced uint8_t will be set to the ID </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">flags</td><td>If present and not NULL, the referenced uint8_t will be set to the FLAGS (not just those addressed to this node). </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if a valid message was copied to buf </dd></dl>

<p>Reimplemented in <a class="el" href="classRF22Router.html#af4f975c229288c480e13de4e6ddea8fb">RF22Router</a>, and <a class="el" href="classRF22Mesh.html#a09ff3e2f1481180881ead85c069fe547">RF22Mesh</a>.</p>

<p>References <a class="el" href="classRF22ReliableDatagram.html#a49dbf986b90cac7f1476ec56a4beab38">recvfromAck()</a>.</p>

</div>
</div>
<a class="anchor" id="a797ad6d1face3b9c4e8862e202a26e5b"></a><!-- doxytag: member="RF22ReliableDatagram::retransmissions" ref="a797ad6d1face3b9c4e8862e202a26e5b" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint16_t RF22ReliableDatagram::retransmissions </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Returns the number of retransmissions we have had to send </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of retransmissions since initialisation. </dd></dl>

</div>
</div>
<a class="anchor" id="a47e85bffb81a3acdff6d5f15ce7bb65e"></a><!-- doxytag: member="RF22ReliableDatagram::sendtoWait" ref="a47e85bffb81a3acdff6d5f15ce7bb65e" args="(uint8_t *buf, uint8_t len, uint8_t address)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">boolean RF22ReliableDatagram::sendtoWait </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>address</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Send the message and waits for an ack. Returns true if an acknowledgement is received. Synchronous: any message other than the desired ACK received while waiting is discarded. Blocks until an ACK is received or all retries are exhausted (ie up to retries*timeout milliseconds). </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">address</td><td>The address to send the message to. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">buf</td><td>Pointer to the binary message to send </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>Number of octets to send </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if the message was transmitted and an acknowledgement was received. </dd></dl>

<p>Reimplemented in <a class="el" href="classRF22Router.html#adb03b403f981659ea55e90867741d085">RF22Router</a>, and <a class="el" href="classRF22Mesh.html#ada9dcba842569c7f126fdb1d085753a5">RF22Mesh</a>.</p>

<p>References <a class="el" href="classRF22Datagram.html#a831ccec7d05b864cc3618f9c21894f17">RF22Datagram::_thisAddress</a>, <a class="el" href="classRF22ReliableDatagram.html#aec55325c6ab74809a3ef9c90aef39adc">acknowledge()</a>, <a class="el" href="classRF22.html#af899b8b15c5c4b345e7f9860d45d0292">RF22::available()</a>, <a class="el" href="classRF22.html#a68be2dd2c22416a9c70fabea8928ff1a">RF22::clearRxBuf()</a>, <a class="el" href="classRF22.html#a3ecbb26863c8bd4bf8cbacde37b73d4f">RF22::headerFlags()</a>, <a class="el" href="classRF22.html#a3d8d98b524d14519f6c39d7136b5a422">RF22::headerFrom()</a>, <a class="el" href="classRF22.html#a74b21003336cc7c6aac1dad128b1f205">RF22::headerId()</a>, <a class="el" href="classRF22.html#ad61bb70ba171a81fa8803219fdc2a433">RF22::headerTo()</a>, <a class="el" href="classRF22Datagram.html#a316535aeb1cb389b593df5f8f1f38983">RF22Datagram::sendto()</a>, <a class="el" href="classRF22.html#adb3ce5021865459e770e45cc434a0dd0">RF22::setHeaderFlags()</a>, <a class="el" href="classRF22.html#a7a36edc1913d6cec8892af8ea8a28ef7">RF22::setHeaderId()</a>, and <a class="el" href="classRF22.html#a8ce6d4f63ce1ea37ab108c01f9476555">RF22::waitPacketSent()</a>.</p>

<p>Referenced by <a class="el" href="classRF22Router.html#a76edfc892808e5b8c1d54f69ba2d8ebd">RF22Router::route()</a>.</p>

</div>
</div>
<a class="anchor" id="add0bf2e27e9ea07871dbe9689dcef465"></a><!-- doxytag: member="RF22ReliableDatagram::setRetries" ref="add0bf2e27e9ea07871dbe9689dcef465" args="(uint8_t retries)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void RF22ReliableDatagram::setRetries </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>retries</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Sets the max number of retries. Defaults to 3. If set to 0, the message will only be sent once. sendtoWait will give up and return false if there is no ack received after all transmissions time out. param[in] retries The maximum number a retries. </p>

</div>
</div>
<a class="anchor" id="a57e6fe9fec497df332ce1f533bf2b2ec"></a><!-- doxytag: member="RF22ReliableDatagram::setTimeout" ref="a57e6fe9fec497df332ce1f533bf2b2ec" args="(uint16_t timeout)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void RF22ReliableDatagram::setTimeout </td>
          <td>(</td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>timeout</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Sets the minimum retransmit timeout. If sendtoWait is waiting for an ack longer than this time (in milliseconds), it will retransmit the message. Defaults to 200ms. The timeout is measured from the end of transmission of the message. It must be at least longer than the the transmit time of the acknowledgement (6 octets) plus the latency/poll time of the receiver. The actual timeout is randomly varied between timeout and timeout*2. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">timeout</td><td>The new timeout period in milliseconds </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="RF22ReliableDatagram_8h_source.html">RF22ReliableDatagram.h</a></li>
<li>RF22ReliableDatagram.cpp</li>
</ul>
</div>


<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
